package edu.strategy.single.defaults;

import java.awt.Color;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;

import robocode.AdvancedRobot;
import robocode.Event;
import robocode.TurnCompleteCondition;
import edu.strategy.single.Single;

public class MagesteryOfColorsDefaultStrategy extends Single{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	static ArrayList<MagesteryOfColorsDefaultStrategy.wave> waves;
	static int dir;
	static double eDirTime;
	static Rectangle2D.Double fieldRect;
	
	public MagesteryOfColorsDefaultStrategy(AdvancedRobot advancedRobot) {
		super(advancedRobot);
	}
	
	public void prepare(){
		fieldRect=new Rectangle2D.Double(18,18,this.getAdvancedRobot().getBattleFieldWidth()-36,this.getAdvancedRobot().getBattleFieldHeight()-36);
		dir=1;
		eDirTime=0;
		waves=new ArrayList<MagesteryOfColorsDefaultStrategy.wave>();
		this.getAdvancedRobot().setAllColors(new Color((int)(250*Math.random()),(int)(250*Math.random()),(int)(250*Math.random())));
		this.getAdvancedRobot().setAdjustGunForRobotTurn(true);
		this.getAdvancedRobot().setAdjustRadarForGunTurn(true);
	}

	@Override
	public void work() {
		super.used();
		if(this.getAdvancedRobot().getRadarTurnRemainingRadians()==0){
			this.getAdvancedRobot().setTurnRadarRightRadians(Double.POSITIVE_INFINITY);
		}
		super.getAdvancedRobot().setAhead(40000);
		super.getAdvancedRobot().setTurnRight(90);
		this.getAdvancedRobot().execute();
	}

	@Override
	public void work(Event e) {
		work();
	}

	public static class wave{
		Point2D.Double startPos;
		double startBearing;
		double velSeg;
		double angle;
		double distSeg;
		double startTime;
		double adSeg;
		double acSeg;
		double wallDist;
		double dirChangeSeg;
	}

	@Override
	public String toString() {
		return "MagesteryOfColorsDefaultStrategy";
	}
}
